<?php
/**
 * Open xml file from selected xml directory by
 * module identifier.
 */
 function smarty_function_xml($params, &$smarty)
 {
    new \Api\Session();
    
    $module = \Api\ObjectLoader::GetObjectSession();
       
    if(array_key_exists('shared', $params) && $params['shared'])
    {
        $path = BASE_PATH.'/public/xml/';
    }else
    {
        $path = BASE_PATH.'/'.$module[\Api\ObjectLoader::C_MODULE].'/public/xml/';
    }
    

    $xml = new \Api\Model\XML();   
    if($xml->Open($path.$params['open'].'.xml') )
    { 
        $smarty->assign($params['assign'],$xml);
    }
    
 }
?>